<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import="com.manage.report.ReportVo"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
	int pageon = 0;
  	int total = 0;
  	int count = 0;
  	String status = "";
  	String chooseValue = "";
  	String chooseType = "";
  	if(request.getAttribute("pageon")!=null){
  		pageon = (Integer)request.getAttribute("pageon");
  	}
  	if(request.getAttribute("total")!=null){
  		total = (Integer)request.getAttribute("total");
  	}
  	if(request.getAttribute("count")!=null){
  		count = (Integer)request.getAttribute("count");
  	}
  	if(request.getAttribute("status")!=null){
  		status = (String)request.getAttribute("status");
  	}
  	if(request.getAttribute("chooseValue")!=null){
  		chooseValue = (String)request.getAttribute("chooseValue");
  	}
  	if(request.getAttribute("chooseType")!=null){
  		chooseType = (String)request.getAttribute("chooseType");
  	}
  	if(total==0){
  		pageon=0;
  	}
  	List queryList = (List)request.getAttribute("queryList");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="javascript" type="text/javascript" src="<%=path%>/js/jquery-1.9.1.min.js"/></script>
<script>
	function check(){
		if($.trim($('#chooseValue').val())!=''&&$('#chooseType').val()==''){
			alert('请选择查询条件')
			return false;
		}
		return true;
	}
	function del(z) {
		var obj = document.getElementsByName("id");
		var ids = "";
		for(var i = 0;i < obj.length;i++) {
	    	if (obj[i].checked) {
	    		ids += "'" + obj[i].value + "',";
	    	}
			if(ids!='') {
				if(confirm("确定要删除吗？删除后将无法还原！请慎重操作！")) {
					document.getElementById('delIds').value = ids.substring(0, ids.length-1);
		   			return true;
				} else {
					return false;
				}
			}
		}
		alert("没有选择记录");
		return false;
	}
	function CheckAll(form) {
		for(var i = 0;i < form.elements.length;i++) {   
		    var e = form.elements[i];
		    
		    if(e.name != "ids") {
		    	e.checked = form.ids.checked;
		    }
		}
	}
	function showMessage(message){
		var res=window.showModalDialog('<%=basePath%>/manage/report/report_show.jsp',message,'dialogWidth:650px;dialogHeight:425px;status:no;directories:yes;scrollbars:no;help=no;');
	}
	var msg="${requestScope.rMsg}";
	if(msg!=""){
		alert(msg);
	}
</script>
<title>Insert title here</title>
<link href="<%=path %>/images/css.css" rel="stylesheet" type="text/css">
</head>

<body class="bg_003">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="201" height="30" align="center" background="<%=path %>/images/016.jpg"><table width="75%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="25"><img src="<%=path %>/images/1.png" width="16" height="16"></td>
        <td><strong>举报受理</strong></td>
      </tr>
    </table></td>
    <td align="right" background="<%=path %>/images/017.jpg" class="zi_006">举报受理查询</td>
    <td width="39"><img src="<%=path %>/images/018.jpg" width="39" height="30"></td>
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="1" bgcolor="#e1e1e2"></td>
        <td height="298" align="center">
		
      	<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#e1e1e1">
		 <form id="queryForm" name="queryForm" action="<%=path %>/report/reportquery.action" method="post">
		          <tr>
		            <td width="85%" height="31" bgcolor="#f5f5f5" colspan="8">
		              查询条件：<select name="reportVo.chooseType" id="chooseType">
		              <option value="">请选择</option>
		              <option value="name" <%if("name".equals(chooseType)) {%>selected="selected"<%} %>>举报人姓名</option>
		              <option value="topic" <%if("topic".equals(chooseType)) {%>selected="selected"<%} %>>标题</option>
		              <option value="message" <%if("message".equals(chooseType)) {%>selected="selected"<%} %>>内容</option>
		              </select>&nbsp;&nbsp;&nbsp;&nbsp;
		              查询内容：<input type="text" name='reportVo.chooseValue' id='chooseValue' value='<%=chooseValue %>'/>&nbsp;&nbsp;&nbsp;&nbsp;
		              信息状态：<select name="reportVo.status" id="status">
		              <option value="">请选择</option>
		              <option value="0" <%if("0".equals(status)) {%>selected="selected"<%} %>>未查阅</option>
		              <option value="1" <%if("1".equals(status)) {%>selected="selected"<%} %>>已查阅</option>
		              </select>&nbsp;&nbsp;&nbsp;&nbsp;
		              <input type="submit" name="searchbutton" id="searchbutton" value=" 查 询 " onclick="return check()"/>
		            </td>
		          </tr>
		</form>
		<form id="queryForm" name="queryForm" action="<%=path %>/report/deletereport.action" method="post">
	          <tr>
	            <th width="10%" height="31" bgcolor="#f5f5f5">
				序号
	            </th>
	            <th width="15%" height="31" bgcolor="#f5f5f5">
	             举报人姓名
	            </th>
	            <th width="15%" height="31" bgcolor="#f5f5f5">
	             联系电话
	            </th>	
	            <th width="10%" height="31" bgcolor="#f5f5f5">
	              邮箱
	            </th>
	            <th width="10%" height="31" bgcolor="#f5f5f5">
	           	主题
	            </th>
	            <th width="10%" height="31" bgcolor="#f5f5f5">
	           	状态
	            </th>
	            <th width="10%" height="31" bgcolor="#f5f5f5">
	           	详细信息
	            </th>
	            <th width="10%" height="31" bgcolor="#f5f5f5">
	            选择
	            </th>
	          </tr>
	          <%
   				if(queryList!=null&&queryList.size()>0){
   					for(int i=0;i<queryList.size();i++){
   						ReportVo vo = (ReportVo)queryList.get(i);
   			%>
	          <tr>
	            <td width="10%" height="31"  bgcolor="#f5f5f5"><%=i+1 %></td>
	            <td width="15%" height="31"  bgcolor="#f5f5f5"><%=vo.getName() %></td>
	            <td width="15%" height="31"  bgcolor="#f5f5f5"><%=vo.getPhonenumber() %></td>
	            <td width="10%" height="31"  bgcolor="#f5f5f5"><%=vo.getEmail() %></td>
	            <td width="10%" height="31"  bgcolor="#f5f5f5"><%=vo.getTopic() %></td>
	            <td width="10%" height="31"  bgcolor="#f5f5f5">
	            <%if("未查阅".equals(vo.getStatus())) {%>
	            	<a href="<%=path %>/report/modifyreport.action?reportVo.id=<%=vo.getId() %>&reportVo.pageon=<%=pageon %>&reportVo.status=<%=status %>&reportVo.chooseType=<%=chooseType %>&reportVo.chooseValue=<%=chooseValue %>")"><%=vo.getStatus()%></a>
	            <%}else{ %>
	            	<%=vo.getStatus() %>
	            <%} %>
	            </td>
	            <td width="10%" height="31"  bgcolor="#f5f5f5"><a href="#" onclick="showMessage('<%=vo.getMessage() %>')">详细信息</a></td>
	            <td  bgcolor="#f5f5f5"><label><input type="checkbox" name="id" value="<%=vo.getId()%>"/></label></td>
	          </tr>
	          <%}} %>
	          <tr>
	          <td colspan="8" height="31" align="right" bgcolor="#f5f5f5">
	          		<input type="checkbox" name="ids" value="on" onclick="CheckAll(this.form);" />选定所有记录
					<input type="hidden" name="reportVo.delIds" id="delIds"/>
					<input type="submit" name="Submit" value="删 除" onclick="return del();"/>
	          </td>
	          </tr>
	          <tr>
	          <td colspan="8" height="31" align="right" bgcolor="#f5f5f5">
					共<%=total %>页&nbsp;&nbsp;&nbsp;第<%=pageon %>页
					<%if(total>0){
						if(pageon != 1) { %>
							<a href="<%=path %>/report/reportquery.action?reportVo.pageon=1&reportVo.status=<%=status %>&reportVo.chooseType=<%=chooseType %>&reportVo.chooseValue=<%=chooseValue %>">第一页</a> 
							<a href="<%=path %>/report/reportquery.action?reportVo.pageon=<%=(pageon - 1) %>&reportVo.status=<%=status %>&reportVo.chooseType=<%=chooseType %>&reportVo.chooseValue=<%=chooseValue %>">上一页</a>
						<%} %>
						<%if(pageon != total) { %>
							<a href="<%=path %>/report/reportquery.action?reportVo.pageon=<%=(pageon + 1) %>&reportVo.status=<%=status %>&reportVo.chooseType=<%=chooseType %>&reportVo.chooseValue=<%=chooseValue %>">下一页</a> 
							<a href="<%=path %>/report/reportquery.action?reportVo.pageon=<%=total %>&reportVo.status=<%=status %>&reportVo.chooseType=<%=chooseType %>&reportVo.chooseValue=<%=chooseValue %>">最后一页</a>
						<%} 
					}%>
	          </td>
	        </tr>
	        </form>
	     </table>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="5" height="5"><img src="<%=path %>/images/019.jpg" width="5" height="5"></td>
        <td width="100%" height="5" class="bg_002"></td>
        <td width="5" height="5"><img src="<%=path %>/images/020.jpg" width="5" height="5"></td>
      </tr>
    </table></td>
  </tr>
</table>
<table width="603" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="26">&nbsp;</td>
  </tr>
</table>
</body>

</html>